package com.egene.tw.api;

import com.egene.tw.network.ApiConstant;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import static com.egene.tw.network.ApiHttpClient.post;

/**
 * Created by WZX on 2015/8/28.
 */
public class ContactApi {
    public final static String API_URL = ApiConstant.API_URL;


    /**
     * 获取留言列表
     * @param userid
     * @param handler
     */
    public static void getMessageList(String userid, AsyncHttpResponseHandler handler){
        RequestParams params = new RequestParams();
        params.put("cmd", "ServerHandler.ListMessage");
        params.put("userid", userid);
        post(API_URL, params, handler);
    }

    /**
     * 发送留言
     * @param userid
     * @param message
     * @param handler
     */
    public static void sendMessage(String userid, String message, AsyncHttpResponseHandler handler){
        RequestParams params = new RequestParams();
        params.put("cmd", "ServerHandler.SendMessage");
        params.put("userid", userid);
        params.put("message", message);
        post(API_URL, params, handler);
    }
}
